<script setup lang="ts">
 import {useRoute} from "vue-router";
 import {onMounted, ref} from "vue";

 import UserCartList from "../../components/UserCartList.vue";
 import {searchUserTag} from "@/api/userSearch.ts";

 const route = useRoute()

 const { tags } = route.query

 const userList = ref([])

 const currentPage = ref(1)
 onMounted(async () => {
   const userListData = await searchUserTag(tags,currentPage.value)
   if(userListData){
     userListData.forEach(user => {
       if(user.tags) {
         user.tags = JSON.parse(user.tags);
       }
     });
     userList.value = userListData
   }
 })

</script>

<template>
  <UserCartList :user-list=" userList "></UserCartList>
  <van-empty v-if="!userList || userList.length<1" image="search" description="没有搜索到相应用户" />
</template>

<style scoped>

</style>